package com.runshu.newsmartark.faceserver;



import com.runshu.newsmartark.base.MyApplication;
import com.runshu.newsmartark.dbutil.FaceDao;
import com.runshu.newsmartark.dbutil.SmartRoomDatabase;

public class RoomFaceDao implements FaceDatabaseAccessObject {
    private static FaceDao dao;
    private SmartRoomDatabase faceRoomDatabase;

    @Override
    public void init() {
        faceRoomDatabase = SmartRoomDatabase.getInstance(MyApplication.getApplication());
        dao = faceRoomDatabase.faceDao();
    }

//    public
//
//    @Override
//    public long insert(FaceEntity userEntity) {
//        return dao == null ? -1 : dao.addFace(userEntity);
//    }
//
//    @Override
//    public List<FaceEntity> getAll() {
//        return dao == null ? null : dao.getAllFace();
//    }
//
//    @Override
//    public void clearAll() {
//        if (dao == null) {
//            return;
//        }
//        dao.deleteAll();
//    }

    @Override
    public void release() {
        if (faceRoomDatabase != null) {
            faceRoomDatabase.close();
            faceRoomDatabase = null;
        }
    }
}
